// 吃到最多的菜, 本质上就是贪心
// 菜可吃进行升序排列, 然后第一个菜必吃, 遇到合适的就吃
const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
let n,k; // n个菜, k为冷却时间
let initArr = [];
rl.on("line", (line)=>{
    if(n === undefined) {
        [n, k] = line.trim().split(" ").map(Number)
    } else {

        initArr.push(line.trim().split(" ").map(Number))
        if(initArr.length === n) {
            console.log(getResult(n,k, initArr))
            // clear
            n = k = undefined
            initArr.length = 0
        }
    }

})

function getResult(n,k, initArr) {
    let arr = []
    initArr.forEach((value, index) => {
        const [a, b] = value
        arr.push(a + b)
    })
    arr.sort((a, b) => a - b)

    //遍历吃菜
    let count = 0
    let lastTime = -Infinity
    for (let i = 0; i < arr.length; i++) {
        let time = arr[i]
        if(time - lastTime - 1 >= k) {
            count++
            lastTime = time
        }
    }
    return count
}